import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import * as session from 'express-session';

//pnpm i express-session @types/express-session 
//pnpm i @nestjs/jwt (可在AppModule引入)

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  //使用 express-session 中间件
  app.use(session({
    secret: 'newking',          //指定加密的密钥 secret
    resave: false,              //true是每次访问都会更新session,false则是内容变更才会更新
    saveUninitialized: false,   //没有登录也会初始化一个空session
  }))

  await app.listen(3000);
}
bootstrap();
